import { Column, Entity, Index, JoinColumn, ManyToOne } from 'typeorm';
import { CommonEntity, CommonStatus } from '~/common/entity/common.entity';
import { TenantEntity } from '../tenant/tenant.entity';

export enum SurveyType {
  // 问卷调查
  SURVEY = 'SURVEY',
  // 问题答题
  QUIZ = 'QUIZ',
}

// 租户 和 疾病 是 一对多 的关系
// 疾病 和 ['问卷调查', '问题答题'] 是 一对多 的关系

@Entity('ah_survey')
@Index(['id', 'type'])
export class SurveyEntity extends CommonEntity {
  @Column({ type: 'varchar', length: 50, nullable: true, default: null, comment: '名称' })
  name: string;

  @Column({ type: 'varchar', length: 500, nullable: true, default: null, comment: '描述' })
  desc: string;

  @Column({ type: 'varchar', comment: '页面ID', name: 'page_id', nullable: true, default: null })
  pageId: string;

  @Column({ type: 'varchar', length: 500, nullable: true, default: null, comment: '链接' })
  link: string;

  @Column({ type: 'tinyint', width: 1, default: CommonStatus.YES, comment: '状态' })
  status: number;

  @Column({ type: 'enum', enum: SurveyType, default: SurveyType.SURVEY, comment: '问卷类型' })
  type: SurveyType;

  @Column({ type: 'int', name: 'tenant_id', comment: '租户ID' })
  tenantId: number;

	// 疾病分类id
	@Column({ type: 'int', name: 'disease_id', comment: '疾病分类ID' })
	diseaseId: number;
}
